/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * SalesMen.java
 *
 * Created on Aug 29, 2010, 12:28:28 PM
 */
package GUI;

import BusinessLogic.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
import javax.swing.table.TableModel;

/**
 *
 * @author MrToan
 */
public class SalesMen extends javax.swing.JPanel {

    /** Creates new form SalesMen */
    private User user;
    private ArrayList<BillDetails> arrBillDetails;
    private Item item;

    public SalesMen(User userObj) {
        arrBillDetails = new ArrayList<BillDetails>();
        user = userObj;
        initComponents();
        CategoryList();
        ItemList();
        GetCusTableValues();
        tableBillsList();
        txtName.setText(user.getName());
        txtPhone.setText(user.getPhone());
        txtEmail.setText(user.getEmail());
        txtAddress.setText(user.getAddress());
        txtUserName.setText(user.getUserName());
        txtRoles.setText(user.getRole());
        txtPer.setText(Integer.toString(user.getPermiss()));
        txtCusID.setEditable(false);
        getDate();
        GenerateBillID();
        GenerateCustID();
        GenerateInfo();
    }
    SalesMenFunction_BL function_BL = new SalesMenFunction_BL();

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        pn_PersonInfo3 = new javax.swing.JPanel();
        lb_Address3 = new javax.swing.JLabel();
        lb_phone3 = new javax.swing.JLabel();
        lb_Email3 = new javax.swing.JLabel();
        txtPhone = new javax.swing.JTextField();
        txtEmail = new javax.swing.JTextField();
        jScrollPane6 = new javax.swing.JScrollPane();
        txtAddress = new javax.swing.JTextArea();
        bnt_Change3 = new javax.swing.JButton();
        jLabel31 = new javax.swing.JLabel();
        txtName = new javax.swing.JTextField();
        pn_MangerInfo4 = new javax.swing.JPanel();
        lb_username4 = new javax.swing.JLabel();
        lb_Roles4 = new javax.swing.JLabel();
        lb_permis4 = new javax.swing.JLabel();
        txtUserName = new javax.swing.JTextField();
        txtRoles = new javax.swing.JTextField();
        txtPer = new javax.swing.JTextField();
        bntChangePass4 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        cbCate = new javax.swing.JComboBox();
        txtItemName = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbItems = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        txtCustomer = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        txtBID = new javax.swing.JTextField();
        bntBrowCus = new javax.swing.JButton();
        txtDate = new javax.swing.JTextField();
        cbPayment = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        txtDiscount = new javax.swing.JTextField();
        txtItem = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        bntBrowItem = new javax.swing.JButton();
        txtBQuantity = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        txtBPrice = new javax.swing.JLabel();
        jPanel13 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        tbBillList = new javax.swing.JTable();
        jLabel30 = new javax.swing.JLabel();
        txtTotalPrice = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        btnCreateBill = new javax.swing.JButton();
        bntAddtoBill = new javax.swing.JButton();
        bntReset = new javax.swing.JButton();
        bntDelete = new javax.swing.JButton();
        jPanel16 = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        btnCancelBill = new javax.swing.JButton();
        btnViewAllBill = new javax.swing.JButton();
        jLabel32 = new javax.swing.JLabel();
        txtViewDate = new javax.swing.JTextField();
        btnViewByDate = new javax.swing.JButton();
        cbOrderBy = new javax.swing.JComboBox();
        jLabel34 = new javax.swing.JLabel();
        jPanel18 = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        tbBillList1 = new javax.swing.JTable();
        jPanel19 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        tbBillDetailsList = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        txtIID = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        txtCate = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        txtIName = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        txtIUnit = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        txtQuantity = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        txtPrice = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        rbAvailable = new javax.swing.JRadioButton();
        rbNotAvailable = new javax.swing.JRadioButton();
        jPanel11 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        tbItem2 = new javax.swing.JTable();
        jPanel14 = new javax.swing.JPanel();
        txtTotalCate = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        bntViewItem = new javax.swing.JButton();
        txtItemAvailable = new javax.swing.JTextField();
        txtTotalItem = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tbCustomer = new javax.swing.JTable();
        btnAddCustomer = new javax.swing.JButton();
        btnResetCustomer = new javax.swing.JButton();
        btnUpdateCustomer = new javax.swing.JButton();
        btnDeleteCustomer = new javax.swing.JButton();
        jPanel15 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtCusAddress = new javax.swing.JTextArea();
        rdMale = new javax.swing.JRadioButton();
        rdFemale = new javax.swing.JRadioButton();
        rdEnableCustomer = new javax.swing.JRadioButton();
        rdDisbleCustomer = new javax.swing.JRadioButton();
        txtCusCountry = new javax.swing.JTextField();
        txtCusID = new javax.swing.JTextField();
        txtCusName = new javax.swing.JTextField();
        txtCusEmail = new javax.swing.JTextField();
        txtCusPhone = new javax.swing.JTextField();
        txtCusCity = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();

        jTabbedPane1.setPreferredSize(new java.awt.Dimension(795, 549));

        pn_PersonInfo3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Personal Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 18))); // NOI18N

        lb_Address3.setText("Address :");

        lb_phone3.setText("Phone :");

        lb_Email3.setText("Email :");

        txtAddress.setColumns(20);
        txtAddress.setRows(5);
        jScrollPane6.setViewportView(txtAddress);

        bnt_Change3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Edit-icon.png"))); // NOI18N
        bnt_Change3.setText("Update");
        bnt_Change3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bnt_Change3ActionPerformed(evt);
            }
        });

        jLabel31.setText("Name :");

        javax.swing.GroupLayout pn_PersonInfo3Layout = new javax.swing.GroupLayout(pn_PersonInfo3);
        pn_PersonInfo3.setLayout(pn_PersonInfo3Layout);
        pn_PersonInfo3Layout.setHorizontalGroup(
            pn_PersonInfo3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pn_PersonInfo3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lb_Address3)
                .addGap(18, 18, 18)
                .addGroup(pn_PersonInfo3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtEmail, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
                    .addComponent(txtPhone, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
                    .addComponent(txtName, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE))
                .addGap(33, 33, 33))
            .addGroup(pn_PersonInfo3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lb_Email3)
                .addContainerGap(247, Short.MAX_VALUE))
            .addGroup(pn_PersonInfo3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lb_phone3)
                .addContainerGap(241, Short.MAX_VALUE))
            .addGroup(pn_PersonInfo3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel31)
                .addContainerGap(244, Short.MAX_VALUE))
            .addGroup(pn_PersonInfo3Layout.createSequentialGroup()
                .addGap(90, 90, 90)
                .addComponent(bnt_Change3)
                .addContainerGap(103, Short.MAX_VALUE))
        );
        pn_PersonInfo3Layout.setVerticalGroup(
            pn_PersonInfo3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pn_PersonInfo3Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addGroup(pn_PersonInfo3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel31)
                    .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(47, 47, 47)
                .addGroup(pn_PersonInfo3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lb_phone3)
                    .addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(45, 45, 45)
                .addGroup(pn_PersonInfo3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtEmail, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lb_Email3, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGroup(pn_PersonInfo3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pn_PersonInfo3Layout.createSequentialGroup()
                        .addGap(71, 71, 71)
                        .addComponent(lb_Address3))
                    .addGroup(pn_PersonInfo3Layout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(bnt_Change3)
                .addGap(38, 38, 38))
        );

        pn_MangerInfo4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Management Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 18))); // NOI18N

        lb_username4.setText("UserName :");

        lb_Roles4.setText("Roles :");

        lb_permis4.setText("Permisson :");

        txtUserName.setEnabled(false);

        txtRoles.setEnabled(false);

        txtPer.setEnabled(false);

        bntChangePass4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Edit-icon.png"))); // NOI18N
        bntChangePass4.setText("Change Password");
        bntChangePass4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntChangePass4bntChangePassActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pn_MangerInfo4Layout = new javax.swing.GroupLayout(pn_MangerInfo4);
        pn_MangerInfo4.setLayout(pn_MangerInfo4Layout);
        pn_MangerInfo4Layout.setHorizontalGroup(
            pn_MangerInfo4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pn_MangerInfo4Layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(pn_MangerInfo4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lb_username4)
                    .addComponent(lb_Roles4)
                    .addComponent(lb_permis4))
                .addGap(49, 49, 49)
                .addGroup(pn_MangerInfo4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtUserName, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE)
                    .addComponent(txtRoles)
                    .addComponent(txtPer))
                .addContainerGap(14, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pn_MangerInfo4Layout.createSequentialGroup()
                .addContainerGap(68, Short.MAX_VALUE)
                .addComponent(bntChangePass4, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(62, 62, 62))
        );
        pn_MangerInfo4Layout.setVerticalGroup(
            pn_MangerInfo4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pn_MangerInfo4Layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(pn_MangerInfo4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb_username4)
                    .addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(37, 37, 37)
                .addGroup(pn_MangerInfo4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb_Roles4)
                    .addComponent(txtRoles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(42, 42, 42)
                .addGroup(pn_MangerInfo4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb_permis4)
                    .addComponent(txtPer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 165, Short.MAX_VALUE)
                .addComponent(bntChangePass4))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addComponent(pn_PersonInfo3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44)
                .addComponent(pn_MangerInfo4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(79, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pn_MangerInfo4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pn_PersonInfo3, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(90, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Information", new javax.swing.ImageIcon(getClass().getResource("/Images/Information-icon.png")), jPanel1); // NOI18N

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Search Form", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        jLabel1.setText("Item Name : ");

        jLabel2.setText("By :");

        cbCate.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-- All Categories --" }));
        cbCate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbCateActionPerformed(evt);
            }
        });

        txtItemName.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtItemNameKeyReleased(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(235, 235, 235)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbCate, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtItemName, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(229, 229, 229))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtItemName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbCate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addContainerGap(48, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Search Resuilt", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        tbItems.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(tbItems);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 747, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Search Items", new javax.swing.ImageIcon(getClass().getResource("/Images/search.png")), jPanel3); // NOI18N

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "General Bills", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        jLabel23.setText("Bill ID :");

        jLabel24.setText("Customer :");

        jLabel25.setText("Payment :");

        jLabel26.setText("Date :");

        txtBID.setEditable(false);

        bntBrowCus.setText("Browser..");
        bntBrowCus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntBrowCusActionPerformed(evt);
            }
        });

        txtDate.setEditable(false);

        cbPayment.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-- Choice payment --", "Visa", "Credit Card", "Cash" }));

        jLabel3.setText("Discount :");

        txtItem.setEditable(false);

        jLabel27.setText("Item :");

        bntBrowItem.setText("Browser..");
        bntBrowItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntBrowItemActionPerformed(evt);
            }
        });

        jLabel28.setText("Quantity :");

        jLabel29.setText("Price :");

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel23)
                    .addComponent(jLabel24)
                    .addComponent(jLabel3)
                    .addComponent(jLabel28))
                .addGap(18, 18, 18)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtBID)
                    .addComponent(txtDiscount, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtCustomer, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtBQuantity, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(bntBrowCus)
                .addGap(41, 41, 41)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel25)
                        .addComponent(jLabel26))
                    .addComponent(jLabel27)
                    .addComponent(jLabel29))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(cbPayment, 0, 221, Short.MAX_VALUE)
                        .addComponent(txtDate, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addComponent(txtItem, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(bntBrowItem)))
                    .addComponent(txtBPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(113, 113, 113))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtBID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23)
                    .addComponent(jLabel26)
                    .addComponent(txtDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24)
                    .addComponent(jLabel25)
                    .addComponent(cbPayment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bntBrowCus))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDiscount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(txtItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27)
                    .addComponent(bntBrowItem))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtBQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel28)
                        .addComponent(jLabel29))
                    .addComponent(txtBPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(100, 100, 100))
        );

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Bill Details", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        tbBillList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane5.setViewportView(tbBillList);

        jLabel30.setText("Total Price :");

        txtTotalPrice.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel37.setText("$");

        btnCreateBill.setText("Create Bill");
        btnCreateBill.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCreateBillActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 747, Short.MAX_VALUE)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(btnCreateBill)
                .addGap(376, 376, 376)
                .addComponent(jLabel30)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtTotalPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel37)
                .addContainerGap(81, Short.MAX_VALUE))
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnCreateBill)
                    .addComponent(jLabel37)
                    .addComponent(txtTotalPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel30))
                .addContainerGap())
        );

        bntAddtoBill.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Add-icon.png"))); // NOI18N
        bntAddtoBill.setText("Add to Bill");
        bntAddtoBill.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntAddtoBillActionPerformed(evt);
            }
        });

        bntReset.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Undo-icon.png"))); // NOI18N
        bntReset.setText("Reset");
        bntReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntResetActionPerformed(evt);
            }
        });

        bntDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Delete-icon.png"))); // NOI18N
        bntDelete.setText("Delete Item");
        bntDelete.setMargin(new java.awt.Insets(2, 4, 2, 14));
        bntDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntDeleteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addComponent(bntAddtoBill)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 131, Short.MAX_VALUE)
                .addComponent(bntReset)
                .addGap(121, 121, 121)
                .addComponent(bntDelete)
                .addGap(154, 154, 154))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bntAddtoBill)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(bntDelete)
                        .addComponent(bntReset)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Bills", new javax.swing.ImageIcon(getClass().getResource("/Images/ordering-icon.png")), jPanel4); // NOI18N

        jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "View Bills", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        btnCancelBill.setText("Cancel Bill");
        btnCancelBill.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelBillActionPerformed(evt);
            }
        });

        btnViewAllBill.setText("View All Bill");
        btnViewAllBill.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnViewAllBillActionPerformed(evt);
            }
        });

        jLabel32.setText("Date :");

        btnViewByDate.setText("View");
        btnViewByDate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnViewByDateActionPerformed(evt);
            }
        });

        cbOrderBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "---- Order By  ---", "---  Bill ID  ---", "--- Quantity ---", "--- Price ---", "--- Total  Price --" }));

        jLabel34.setText("Date Format : MM/DD/YYYY");

        javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout.setHorizontalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addGap(57, 57, 57)
                .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel17Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabel34, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(txtViewDate, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(36, 36, 36)
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel17Layout.createSequentialGroup()
                        .addComponent(btnViewAllBill)
                        .addGap(34, 34, 34)
                        .addComponent(btnCancelBill, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE))
                    .addGroup(jPanel17Layout.createSequentialGroup()
                        .addComponent(cbOrderBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(28, 28, 28)
                        .addComponent(btnViewByDate, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(214, 214, 214))
        );
        jPanel17Layout.setVerticalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel17Layout.createSequentialGroup()
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel32)
                    .addComponent(txtViewDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbOrderBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnViewByDate))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel34, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnViewAllBill)
                    .addComponent(btnCancelBill))
                .addContainerGap())
        );

        jPanel18.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Bills List", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        tbBillList1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tbBillList1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbBillList1MouseClicked(evt);
            }
        });
        jScrollPane8.setViewportView(tbBillList1);

        javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18);
        jPanel18.setLayout(jPanel18Layout);
        jPanel18Layout.setHorizontalGroup(
            jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 747, Short.MAX_VALUE)
        );
        jPanel18Layout.setVerticalGroup(
            jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
        );

        jPanel19.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Bill Detail List", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        tbBillDetailsList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane9.setViewportView(tbBillDetailsList);

        javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19);
        jPanel19.setLayout(jPanel19Layout);
        jPanel19Layout.setHorizontalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 747, Short.MAX_VALUE)
        );
        jPanel19Layout.setVerticalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel19, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel18, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel17, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel16Layout.setVerticalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Bill Details", new javax.swing.ImageIcon(getClass().getResource("/Images/ordering-icon.png")), jPanel16); // NOI18N

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Items Details", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N
        jPanel9.setPreferredSize(new java.awt.Dimension(750, 139));

        jLabel16.setText("Items ID :");

        jLabel17.setText("Category :");

        jLabel18.setText("Item Name :");

        jLabel19.setText("Unit :");

        jLabel20.setText("Quantity :");

        jLabel21.setText("Price :");

        jLabel22.setText("Status :");

        buttonGroup3.add(rbAvailable);
        rbAvailable.setText("Available");

        buttonGroup3.add(rbNotAvailable);
        rbNotAvailable.setText("Not Available");

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel18)
                    .addComponent(jLabel17)
                    .addComponent(jLabel19)
                    .addComponent(jLabel16))
                .addGap(4, 4, 4)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(txtIUnit)
                    .addComponent(txtIName)
                    .addComponent(txtCate)
                    .addComponent(txtIID, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(41, 41, 41)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel21)
                    .addComponent(jLabel20)
                    .addComponent(jLabel22))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtQuantity)
                    .addComponent(txtPrice)
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addComponent(rbAvailable)
                        .addGap(18, 18, 18)
                        .addComponent(rbNotAvailable)))
                .addGap(204, 204, 204))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtIID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20)
                    .addComponent(jLabel16))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtCate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21)
                    .addComponent(jLabel17))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtIName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rbAvailable)
                    .addComponent(rbNotAvailable)
                    .addComponent(jLabel22)
                    .addComponent(jLabel18))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtIUnit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Items List", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        tbItem2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tbItem2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbItem2MouseClicked(evt);
            }
        });
        jScrollPane7.setViewportView(tbItem2);

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 747, Short.MAX_VALUE)
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
        );

        jPanel14.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtTotalCate.setEditable(false);

        jLabel15.setText("Total Categories :");

        bntViewItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/1283060576_eye.png"))); // NOI18N
        bntViewItem.setText("View");
        bntViewItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntViewItemActionPerformed(evt);
            }
        });

        txtItemAvailable.setEditable(false);

        txtTotalItem.setEditable(false);

        jLabel14.setText("Total Items :");

        jLabel13.setText("Items Available :");

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addGap(94, 94, 94)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel15)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtTotalItem)
                    .addComponent(txtTotalCate, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE))
                .addGap(39, 39, 39)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel13)
                    .addComponent(bntViewItem))
                .addGap(10, 10, 10)
                .addComponent(txtItemAvailable, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(139, Short.MAX_VALUE))
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup()
                .addContainerGap(77, Short.MAX_VALUE)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(txtTotalItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bntViewItem))
                .addContainerGap())
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(txtTotalCate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(txtItemAvailable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(68, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel11, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel14, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Inventory Status", new javax.swing.ImageIcon(getClass().getResource("/Images/packing-icon.png")), jPanel2); // NOI18N

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Customers List", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        tbCustomer.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tbCustomer.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbCustomerMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(tbCustomer);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 747, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)
        );

        btnAddCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Add-icon.png"))); // NOI18N
        btnAddCustomer.setText("Add New");
        btnAddCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddCustomerActionPerformed(evt);
            }
        });

        btnResetCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Undo-icon.png"))); // NOI18N
        btnResetCustomer.setText("Reset");
        btnResetCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnResetCustomerActionPerformed(evt);
            }
        });

        btnUpdateCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Edit-icon.png"))); // NOI18N
        btnUpdateCustomer.setText("Update");
        btnUpdateCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateCustomerActionPerformed(evt);
            }
        });

        btnDeleteCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/Delete-icon.png"))); // NOI18N
        btnDeleteCustomer.setText("Delete");
        btnDeleteCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteCustomerActionPerformed(evt);
            }
        });

        jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Customer Information", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        txtCusAddress.setColumns(20);
        txtCusAddress.setRows(5);
        jScrollPane2.setViewportView(txtCusAddress);

        buttonGroup2.add(rdMale);
        rdMale.setText("Male");

        buttonGroup2.add(rdFemale);
        rdFemale.setText("Female");

        buttonGroup1.add(rdEnableCustomer);
        rdEnableCustomer.setText("Enable");

        buttonGroup1.add(rdDisbleCustomer);
        rdDisbleCustomer.setText("Disable");

        jLabel7.setText("Address :");

        jLabel12.setText("Gender :");

        jLabel11.setText("Status :");

        jLabel10.setText("Country :");

        jLabel4.setText("Customer ID :");

        jLabel5.setText("Customer Name :");

        jLabel6.setText("Email :");

        jLabel8.setText("Contact Phone :");

        jLabel9.setText("City :");

        javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addGap(68, 68, 68)
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4)
                    .addComponent(jLabel8)
                    .addComponent(jLabel6)
                    .addComponent(jLabel9))
                .addGap(21, 21, 21)
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtCusCity)
                    .addComponent(txtCusPhone)
                    .addComponent(txtCusEmail, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtCusName, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)
                    .addComponent(txtCusID, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE))
                .addGap(80, 80, 80)
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel15Layout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel15Layout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addGap(18, 18, 18)
                        .addComponent(rdFemale)
                        .addGap(18, 18, 18)
                        .addComponent(rdMale))
                    .addGroup(jPanel15Layout.createSequentialGroup()
                        .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel15Layout.createSequentialGroup()
                                .addComponent(rdDisbleCustomer)
                                .addGap(18, 18, 18)
                                .addComponent(rdEnableCustomer))
                            .addComponent(txtCusCountry, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(89, Short.MAX_VALUE))
        );
        jPanel15Layout.setVerticalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addContainerGap(11, Short.MAX_VALUE)
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel15Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(109, 109, 109))
                    .addGroup(jPanel15Layout.createSequentialGroup()
                        .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtCusID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12)
                            .addComponent(rdFemale)
                            .addComponent(rdMale))
                        .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel15Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel5)
                                    .addComponent(txtCusName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel15Layout.createSequentialGroup()
                                        .addGap(23, 23, 23)
                                        .addComponent(jLabel8))
                                    .addGroup(jPanel15Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(txtCusPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(jPanel15Layout.createSequentialGroup()
                                .addGap(22, 22, 22)
                                .addComponent(jLabel7))
                            .addGroup(jPanel15Layout.createSequentialGroup()
                                .addGap(4, 4, 4)
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtCusEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel6)
                                .addComponent(jLabel10)
                                .addComponent(txtCusCountry, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(18, 18, 18)
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel11)
                        .addComponent(rdDisbleCustomer)
                        .addComponent(rdEnableCustomer))
                    .addComponent(jLabel9)
                    .addComponent(txtCusCity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jPanel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel7Layout.createSequentialGroup()
                        .addGap(64, 64, 64)
                        .addComponent(btnAddCustomer)
                        .addGap(73, 73, 73)
                        .addComponent(btnResetCustomer)
                        .addGap(77, 77, 77)
                        .addComponent(btnUpdateCustomer)
                        .addGap(86, 86, 86)
                        .addComponent(btnDeleteCustomer)))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnAddCustomer)
                    .addComponent(btnResetCustomer)
                    .addComponent(btnUpdateCustomer)
                    .addComponent(btnDeleteCustomer))
                .addGap(23, 23, 23))
        );

        jTabbedPane1.addTab("Customers", new javax.swing.ImageIcon(getClass().getResource("/Images/1283061001_Users_Group.png")), jPanel7); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 784, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 560, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void bntChangePass4bntChangePassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntChangePass4bntChangePassActionPerformed
        // TODO add your handling code here:
        new ChangePass(user).setVisible(true);
}//GEN-LAST:event_bntChangePass4bntChangePassActionPerformed

    private void bnt_Change3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnt_Change3ActionPerformed
        // TODO add your handling code here:
        if (ValidateInfoForm() == 1) {
            String message = new AdminFunction().updateInfor_BL(user.getUserID(), txtName.getText(), txtPhone.getText(), txtEmail.getText(), txtAddress.getText());
            JOptionPane.showMessageDialog(this, message);
        }
}//GEN-LAST:event_bnt_Change3ActionPerformed

    private void bntAddtoBillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntAddtoBillActionPerformed
        // TODO add your handling code here:
        if (ValidateBillForm() == 1) {
            //String _Date = DateStoreDB();
            //int AddSuccess = function_BL.AddBill(CusID, _Date, UID, PayMent, Discount, Status, Total);
            int quantity = 0;
            try {
                quantity = Integer.valueOf(txtBQuantity.getText());
            } catch (NumberFormatException ex) {
                JOptionPane.showMessageDialog(this, "Fomat invalid.", "Error", JOptionPane.ERROR_MESSAGE);
                txtQuantity.requestFocus();
                return;
            }
            item = new SalesMenFunction_BL().getItemInfor(txtItem.getText());
            boolean bFound = false;

            for (BillDetails detail : arrBillDetails) {
                if (detail.getItemID().equals(item.getI_ID())) {
                    detail.setQuantity(detail.getQuantity() + quantity);
                    bFound = true;
                    break;
                }
            }
            if (bFound == false) {
                BillDetails detail = new BillDetails();
                detail.setItemID(item.getI_ID());
                detail.setPrice(item.getI_Price());
                detail.setQuantity(quantity);
                arrBillDetails.add(detail);
            }
            tableNew();
        }
    }//GEN-LAST:event_bntAddtoBillActionPerformed

    public void tableNew() {
        tbBillList.setModel(new modelBillDetails().modelbd(arrBillDetails));
        calcTotal();
    }

    private float calcTotal() {
        float dTotal = 0;

        for (BillDetails detail : arrBillDetails) {
            dTotal += detail.getPrice() * detail.getQuantity();
        }

        double dDiscount = 0;
        try {
            dDiscount = Double.valueOf(txtDiscount.getText());
        } catch (Exception ex) {
        }
        dDiscount = Math.min(Math.max(dDiscount, 0), 100);
        dTotal *= (100 - dDiscount) / 100;
        txtTotalPrice.setText(String.valueOf(dTotal));
        return dTotal;
    }

    public void getCusID(String ID) {
        txtCustomer.setText(ID);
    }

    private void bntBrowCusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntBrowCusActionPerformed
        // TODO add your handling code here:
        cusForm = new Customers();
        cusForm.setVisible(true);
    }//GEN-LAST:event_bntBrowCusActionPerformed

    private void bntBrowItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntBrowItemActionPerformed
        // TODO add your handling code here:
        new Items().setVisible(true);
    }//GEN-LAST:event_bntBrowItemActionPerformed

    private void bntResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntResetActionPerformed
        // TODO add your handling code here:
        ResetBillForm();
        GenerateBillID();
    }//GEN-LAST:event_bntResetActionPerformed

    private void bntDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntDeleteActionPerformed
        // TODO add your handling code here:
        int iSelected=tbBillList.getSelectedRow();
        if(iSelected<0)
        {
             JOptionPane.showMessageDialog(this, "Please choose one !");
                return;
        }
        arrBillDetails.remove(iSelected);
        tableNew();
    }//GEN-LAST:event_bntDeleteActionPerformed

    public void GenerateBillID() {
        int _BID = (function_BL.getBillID()) + 1;
        String _ID = String.valueOf(_BID);
        txtBID.setText(_ID);
    }

    private void cbCateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbCateActionPerformed
        // TODO add your handling code here:
        String cateChanged = (String) cbCate.getSelectedItem();
        TableModel tbm = new SalesMenFunction_BL().ItemTableChanged(cateChanged);
        tbItems.setModel(tbm);

    }//GEN-LAST:event_cbCateActionPerformed

    private void txtItemNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtItemNameKeyReleased
        // TODO add your handling code here:
        String itemName = txtItemName.getText();
        String cateName = (String) cbCate.getSelectedItem();
        System.out.println("" + cateName);
        TableModel getItemtable = new SalesMenFunction_BL().getItembyName(itemName, cateName);
        tbItems.setModel(getItemtable);
    }//GEN-LAST:event_txtItemNameKeyReleased

    private void btnAddCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddCustomerActionPerformed
        // TODO add your handling code here:
        if (ValidateCustomerForm()) {
            String message = new SalesMenFunction_BL().addNewCustomer(txtCusName.getText(), txtCusEmail.getText(), txtCusAddress.getText(), txtCusPhone.getText(), CusGender, txtCusCity.getText(), txtCusCountry.getText(), Status, 0);
            GetCusTableValues();
            JOptionPane.showMessageDialog(this, message);
            resetCustomerForm();
            GenerateCustID();
        }
    }//GEN-LAST:event_btnAddCustomerActionPerformed

    private void tbCustomerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbCustomerMouseClicked
        // TODO add your handling code here:
        int counts = tbCustomer.getSelectedRow();
        String _CID = (String) tbCustomer.getValueAt(counts, 0);
        String _Name = (String) tbCustomer.getValueAt(counts, 1);
        String _Email = (String) tbCustomer.getValueAt(counts, 2);
        String _Address = (String) tbCustomer.getValueAt(counts, 3);
        String _Tel = (String) tbCustomer.getValueAt(counts, 4);
        String _Gender = (String) tbCustomer.getValueAt(counts, 5);
        String _City = (String) tbCustomer.getValueAt(counts, 6);
        String _Country = (String) tbCustomer.getValueAt(counts, 7);
        String _Status = (String) tbCustomer.getValueAt(counts, 8);
        String _Purchased = (String) tbCustomer.getValueAt(counts, 9);
        txtCusID.setText(_CID);
        txtCusName.setText(_Name);
        txtCusEmail.setText(_Email);
        txtCusAddress.setText(_Address);
        txtCusPhone.setText(_Tel);
        if (Integer.parseInt(_Gender) == 1) {
            rdFemale.setSelected(true);
        } else {
            rdMale.setSelected(true);
        }
        txtCusCity.setText(_City);
        txtCusCountry.setText(_Country);
        if (Integer.parseInt(_Status) == 1) {
            rdEnableCustomer.setSelected(true);
        }
    }//GEN-LAST:event_tbCustomerMouseClicked
    public void GenerateCustID() {
        int C_ID = (function_BL.getCustID()) + 1;
        String _ID = String.valueOf(C_ID);
        txtCusID.setText(_ID);
    }
    private void btnResetCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnResetCustomerActionPerformed
        // TODO add your handling code here:
        resetCustomerForm();
        GenerateCustID();
    }//GEN-LAST:event_btnResetCustomerActionPerformed
    public void resetCustomerForm() {
        txtCusID.setText("");
        txtCusName.setText("");
        txtCusEmail.setText("");
        txtCusAddress.setText("");
        txtCusPhone.setText("");
        buttonGroup2.clearSelection();
        txtCusCity.setText("");
        txtCusCountry.setText("");
        buttonGroup1.clearSelection();
    }
    private void btnUpdateCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateCustomerActionPerformed
        // TODO add your handling code here:
        if (ValidateCustomerForm()) {
            String message = new SalesMenFunction_BL().updateCustomer(Integer.parseInt(txtCusID.getText()), txtCusName.getText(), txtCusEmail.getText(), txtCusAddress.getText(), txtCusPhone.getText(), CusGender, txtCusCity.getText(), txtCusCountry.getText(), Status, 0);
            JOptionPane.showMessageDialog(this, message);
            GetCusTableValues();
            resetCustomerForm();
            GenerateCustID();
        }
    }//GEN-LAST:event_btnUpdateCustomerActionPerformed

    private void btnDeleteCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteCustomerActionPerformed
        // TODO add your handling code here:
        int delete = JOptionPane.showConfirmDialog(this, "Do you want to delete this Customer?", "Delete Customer", JOptionPane.OK_CANCEL_OPTION);
        if (delete == 0) {
            String message = new SalesMenFunction_BL().deleteCustomer(Integer.parseInt(txtCusID.getText()));
            JOptionPane.showMessageDialog(this, message);
            GetCusTableValues();
            resetCustomerForm();
            GenerateCustID();
        }
    }//GEN-LAST:event_btnDeleteCustomerActionPerformed

    private void btnViewAllBillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewAllBillActionPerformed
        // TODO add your handling code here:
            TableModel tb= function_BL.getItemByDate(DateToView,5);
            tbBillList1.setModel(tb);
    }//GEN-LAST:event_btnViewAllBillActionPerformed

    private void btnCreateBillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreateBillActionPerformed
        // TODO add your handling code here:
        Bill bill=new Bill();
        bill.setB_ID(Integer.parseInt(txtBID.getText()));
        bill.setU_ID(user.getUserID());
        bill.setCustID(Integer.parseInt(txtCustomer.getText()));
        bill.setDate(getDate("MM/dd/yyyy"));
        bill.setDiscount(Float.parseFloat(txtDiscount.getText()));
        bill.setPayment((String)cbPayment.getSelectedItem());
        bill.setTotal(Float.parseFloat(txtTotalPrice.getText()));

        bill.setStatus(true);
         try {
            String message = new SalesMenFunction_BL().addNewBill(bill,arrBillDetails);
            JOptionPane.showMessageDialog(this, message);
            txtDiscount.setText("0");
            txtBQuantity.setText("");
            txtCustomer.setText("");
            txtItem.setText("");
            txtBPrice.setText("");
            tableBillsList();
            GenerateBillID();
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Cannot create a new bill");
            return;
        }
        arrBillDetails.clear();
        tableNew();
    }//GEN-LAST:event_btnCreateBillActionPerformed

    private void tbBillList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbBillList1MouseClicked
        // TODO add your handling code here:
        int counts = tbBillList1.getSelectedRow();
        B_ID = (String)tbBillList1.getValueAt(counts, 0);
        TableModel tmbDetails = new SalesMenFunction_BL().getBillDetails(Integer.parseInt(B_ID));
        tbBillDetailsList.setModel(tmbDetails);
    }//GEN-LAST:event_tbBillList1MouseClicked

    private void btnCancelBillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelBillActionPerformed
        // TODO add your handling code here:
        int confirm = JOptionPane.showConfirmDialog(this, "Do you want to cancel this Bill?", "Cancel bill", JOptionPane.OK_CANCEL_OPTION);
        int billID= Integer.parseInt(B_ID);
        if(confirm==0)
        {
            String message = new SalesMenFunction_BL().cancelBill(billID);
            JOptionPane.showMessageDialog(this, message);
            tableBillsList();
        }
    }//GEN-LAST:event_btnCancelBillActionPerformed

    private void bntViewItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntViewItemActionPerformed
        // TODO add your handling code here:
        TableModel Tb=function_BL.ViewItem();
        tbItem2.setModel(Tb);
    }//GEN-LAST:event_bntViewItemActionPerformed

    private void tbItem2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbItem2MouseClicked
        // TODO add your handling code here:
        int countRow=tbItem2.getSelectedRow();

        String IID=(String) tbItem2.getValueAt(countRow,0);
        String ICID=(String) tbItem2.getValueAt(countRow,1);
        String IName=(String) tbItem2.getValueAt(countRow,2);
        String IUnit=(String) tbItem2.getValueAt(countRow,3);
        String IQuantity=(String) tbItem2.getValueAt(countRow,4);
        String IPrice=(String) tbItem2.getValueAt(countRow,5);
        String I_Status=(String) tbItem2.getValueAt(countRow,6);
        int status=Integer.parseInt(I_Status);

        txtIID.setText(IID);
        txtCate.setText(ICID);
        txtIName.setText(IName);
        txtIUnit.setText(IUnit);
        txtQuantity.setText(IQuantity);
        txtPrice.setText(IPrice);
        rbAvailable.setSelected(true);

    }//GEN-LAST:event_tbItem2MouseClicked

    private void btnViewByDateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewByDateActionPerformed
        // TODO add your handling code here:
        if(ViewItemByDate()==1)
        {
            int index=cbOrderBy.getSelectedIndex();
            TableModel tb= function_BL.getItemByDate(DateToView,index);
            tbBillList1.setModel(tb);
        }
    }//GEN-LAST:event_btnViewByDateActionPerformed


    public int ViewItemByDate()
    {
        DateToView=txtViewDate.getText();
        Pattern pat=Pattern.compile("\\d{1,2}/\\d{1,2}/\\d{4}");
        Matcher mat=pat.matcher(Date);
        if(DateToView.equals(""))
        {
            JOptionPane.showMessageDialog(this,"Enter Date to View ! ","Error !",2,null);
            txtViewDate.requestFocus();
            return 0;
        }
        else if(!mat.find())
        {
            JOptionPane.showMessageDialog(this,"Date Format Error ! Try Againt !","Error !",2,null);
            txtViewDate.requestFocus();
            return 0;
        }
        return 1;
    }




    public void tableBillsList()
    {
        TableModel tb = new SalesMenFunction_BL().tableBillList();
        tbBillList1.setModel(tb);

    }

    //Method get today Date
    public String getDate(String dateFormat)
    {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sd = new SimpleDateFormat(dateFormat);
        String dateNow = (String)sd.format(cal.getTime());
        return dateNow;        
    }
//method validate Information form
    public int ValidateInfoForm() {
        InfoName = txtName.getText();
        InfoPhone = txtPhone.getText();
        InfoEmail = txtEmail.getText();
        InfoAddress = txtAddress.getText();
        InfoUserName = txtUserName.getText();
        InfoRoles = txtRoles.getText();
        String per = txtPer.getText();
        if (InfoName.equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Your Name !", "Error !", 2, null);
            txtName.requestFocus();
            return 0;
        } else if (InfoPhone.equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Your Phone Number !", "Error !", 2, null);
            txtPhone.requestFocus();
            return 0;
        } else if (InfoEmail.equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Your Contac Email !", "Error !", 2, null);
            txtEmail.requestFocus();
            return 0;
        } else if (InfoAddress.equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Your Address !", "Error !", 2, null);
            txtAddress.requestFocus();
            return 0;
        }
        return 1;
    }
//method validate Bill Form

    public int ValidateBillForm() {
        int check = 0;
        BID = txtBID.getText();
        CusID = txtCustomer.getText();
        Date = txtDate.getText();
        UID = user.getUserID();
        int choicePayment = cbPayment.getSelectedIndex();
        PayMent = cbPayment.getSelectedItem().toString();
        String DC = txtDiscount.getText();
        Status = 1;
        String total = txtTotalPrice.getText();
        String quantity = txtBQuantity.getText();
        String price = txtBPrice.getText();
        Item = txtItem.getText();


        if (BID.equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Bill ID !", "Error !", 2, null);
            txtBID.requestFocus();
            return 0;
        } else if (CusID.equals("")) {
            JOptionPane.showMessageDialog(this, "Choice Customer !", "Error !", 2, null);
            txtCustomer.requestFocus();
            return 0;
        } else if (choicePayment == 0) {
            JOptionPane.showMessageDialog(this, "Choice Payment !", "Error !", 2, null);
            cbPayment.requestFocus();
            return 0;
        } else if (DC.equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Discount !", "Error !", 2, null);
            txtDiscount.requestFocus();
            check = 1;
            return 0;
        } else if (quantity.equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Item's Quantity !", "Error !", 2, null);
            txtBID.requestFocus();
            check = 1;
            return 0;
        } else if (Item.equals("")) {
            JOptionPane.showMessageDialog(this, "Choice Item !", "Error !", 2, null);
            txtBID.requestFocus();
            return 0;
        }
        if (check == 0) {
            Quantity = Integer.parseInt(quantity);
            Discount = Float.parseFloat(DC);
            Price = Float.parseFloat(price);
        }
        return 1;
    }

    public boolean ValidateCustomerForm() {
        int StatusChoice = 0;
        if (rdEnableCustomer.isSelected()) {
            Status = 1;
            StatusChoice = 1;
        } else if (rdDisbleCustomer.isSelected()) {
            Status = 0;
            StatusChoice = 1;
        }
        if (rdFemale.isSelected()) {
            CusGender = true;
        } else {
            CusGender = false;
        }

        if (txtCusName.getText().equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Name !", "Error !", 2, null);
            txtCusName.requestFocus();
            return false;
        } else if (txtCusPhone.getText().equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Phone !", "Error !", 2, null);
            txtCusPhone.requestFocus();
            return false;
        } else if (txtCusAddress.getText().equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Address !", "Error !", 2, null);
            txtCusAddress.requestFocus();
            return false;
        } else if (txtCusEmail.getText().equals("")) {
            JOptionPane.showMessageDialog(this, "Enter Email !", "Error !", 2, null);
            txtCusEmail.requestFocus();
            return false;
        } else if (txtCusCity.getText().equals("")) {
            JOptionPane.showMessageDialog(this, "Enter City!", "Error !", 2, null);
            txtCusCity.requestFocus();
            return false;
        } else if (!rdFemale.isSelected() && !rdMale.isSelected()) {
            JOptionPane.showMessageDialog(this, "Select Gender!", "Error !", 2, null);
            return false;
        } else if (StatusChoice == 0) {
            JOptionPane.showMessageDialog(this, "Choice Status of Customer !", "Error !", 2, null);
            return false;
        }
        Pattern PhonePattern = Pattern.compile("[a-zA-Z]");
        Matcher PhoneMatcher = PhonePattern.matcher(txtCusPhone.getText());
        if (PhoneMatcher.find()) {
            JOptionPane.showMessageDialog(this, "Phone Number must not containt character !", "Error !", 2, null);
            txtCusPhone.setText("");
            txtCusPhone.requestFocus();
            return false;
        }
        Pattern NamePattern = Pattern.compile("[\\d]");
        Matcher NameMatcher = NamePattern.matcher(txtCusName.getText());
        if (NameMatcher.find()) {
            JOptionPane.showMessageDialog(this, "Name must not containt digit !", "Error !", 2, null);
            txtCusName.setText("");
            txtCusName.requestFocus();
            return false;
        }

        Pattern EmailPattren = Pattern.compile("^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$");
        Matcher EmailMatcher = EmailPattren.matcher(txtCusEmail.getText());
        if (!EmailMatcher.find()) {
            JOptionPane.showMessageDialog(this, "Invalid Email Address !", "Error !", 2, null);
            txtCusEmail.setText("");
            txtCusEmail.requestFocus();
            return false;
        }

        return true;
    }

    public void ItemList() {
        TableModel tbm = new SalesMenFunction_BL().ItemTable();
        tbItems.setModel(tbm);
    }

    public void GetCusTableValues() {
        TableModel tb = new SalesMenFunction_BL().UserTable();
        tbCustomer.setModel(tb);
    }

    public void CategoryList() {
        Vector CateList = new SalesMenFunction_BL().getCategory();
        for (Object o : CateList) {
            cbCate.addItem(o);
        }
    }

    public void getDate() {
        String dateFormat = "dd/MM/yyyy";
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sd = new SimpleDateFormat(dateFormat);
        Date = (String) sd.format(cal.getTime());
        txtDate.setText(Date);
        txtViewDate.setText(Date);
    }

    public String DateStoreDB() {
        String dateFormat = "MM/dd/yyyy";
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sd = new SimpleDateFormat(dateFormat);
        String date = (String) sd.format(cal.getTime());
        return date;
    }

    public void getBillList() {
        TableModel tb = function_BL.BillTable(Date);
        tbBillList.setModel(tb);
    }

    public void GenerateInfo()
    {
        int TotalCate= function_BL.CountCate();
        txtTotalCate.setText(String.valueOf(TotalCate));

        int TotalItem=function_BL.CountItem();
        txtTotalItem.setText(String.valueOf(TotalItem));

        int itemAvailable=function_BL.ViewItemAvailable();
        txtItemAvailable.setText(String.valueOf(itemAvailable));
    }



    public void ResetBillForm() {
        txtCustomer.setText("");
        cbPayment.setSelectedIndex(0);
        txtDiscount.setText("");
        txtTotalPrice.setText("");
        txtBQuantity.setText("");
        txtBPrice.setText("");
        txtItem.setText("");
        GenerateBillID();
    }


    private String DateToView;
    private Customers cusForm;
    private int CustID;
    private String ID;
    private String B_ID;
    //variable for Information form
    private String InfoName;
    private String InfoPhone;
    private String InfoEmail;
    private String InfoAddress;
    private String InfoUserName;
    private String InfoRoles;
    private int InfoPermission;
    //variable for Bill form
    private String Item;
    private String BID;
    private String CusID;
    private String Date;
    private String UID;
    private String PayMent;
    private float Discount;
    private int Status;
    public static float Total;
    public static int Quantity;
    public static float Price;
    private boolean CusGender;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bntAddtoBill;
    private javax.swing.JButton bntBrowCus;
    private javax.swing.JButton bntBrowItem;
    private javax.swing.JButton bntChangePass4;
    private javax.swing.JButton bntDelete;
    private javax.swing.JButton bntReset;
    private javax.swing.JButton bntViewItem;
    private javax.swing.JButton bnt_Change3;
    private javax.swing.JButton btnAddCustomer;
    private javax.swing.JButton btnCancelBill;
    private javax.swing.JButton btnCreateBill;
    private javax.swing.JButton btnDeleteCustomer;
    private javax.swing.JButton btnResetCustomer;
    private javax.swing.JButton btnUpdateCustomer;
    private javax.swing.JButton btnViewAllBill;
    private javax.swing.JButton btnViewByDate;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.JComboBox cbCate;
    private javax.swing.JComboBox cbOrderBy;
    private javax.swing.JComboBox cbPayment;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel lb_Address3;
    private javax.swing.JLabel lb_Email3;
    private javax.swing.JLabel lb_Roles4;
    private javax.swing.JLabel lb_permis4;
    private javax.swing.JLabel lb_phone3;
    private javax.swing.JLabel lb_username4;
    private javax.swing.JPanel pn_MangerInfo4;
    private javax.swing.JPanel pn_PersonInfo3;
    private javax.swing.JRadioButton rbAvailable;
    private javax.swing.JRadioButton rbNotAvailable;
    private javax.swing.JRadioButton rdDisbleCustomer;
    private javax.swing.JRadioButton rdEnableCustomer;
    private javax.swing.JRadioButton rdFemale;
    private javax.swing.JRadioButton rdMale;
    private javax.swing.JTable tbBillDetailsList;
    private javax.swing.JTable tbBillList;
    private javax.swing.JTable tbBillList1;
    private javax.swing.JTable tbCustomer;
    private javax.swing.JTable tbItem2;
    private javax.swing.JTable tbItems;
    private javax.swing.JTextArea txtAddress;
    private javax.swing.JTextField txtBID;
    static javax.swing.JLabel txtBPrice;
    static javax.swing.JTextField txtBQuantity;
    private javax.swing.JTextField txtCate;
    private javax.swing.JTextArea txtCusAddress;
    private javax.swing.JTextField txtCusCity;
    private javax.swing.JTextField txtCusCountry;
    private javax.swing.JTextField txtCusEmail;
    private javax.swing.JTextField txtCusID;
    private javax.swing.JTextField txtCusName;
    private javax.swing.JTextField txtCusPhone;
    static javax.swing.JTextField txtCustomer;
    private javax.swing.JTextField txtDate;
    private javax.swing.JTextField txtDiscount;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtIID;
    private javax.swing.JTextField txtIName;
    private javax.swing.JTextField txtIUnit;
    static javax.swing.JTextField txtItem;
    private javax.swing.JTextField txtItemAvailable;
    private javax.swing.JTextField txtItemName;
    private javax.swing.JTextField txtName;
    private javax.swing.JTextField txtPer;
    private javax.swing.JTextField txtPhone;
    private javax.swing.JTextField txtPrice;
    private javax.swing.JTextField txtQuantity;
    private javax.swing.JTextField txtRoles;
    private javax.swing.JTextField txtTotalCate;
    private javax.swing.JTextField txtTotalItem;
    static javax.swing.JLabel txtTotalPrice;
    private javax.swing.JTextField txtUserName;
    private javax.swing.JTextField txtViewDate;
    // End of variables declaration//GEN-END:variables
}
